/**
 * 提交请求
 * @param url 地址
 * @param params 参数
 * @param callback 成功回调
 * @param errorback 异常回调
 */

function doSubmit(url, params, callback, errorback) {
    $.ajax({
        url: url,
        type: 'POST',
        data: JSON.stringify(params),
        contentType: 'application/json',
        header: {
            Accept: "application/json; charset=utf-8"
        },
        success: function (data) {
            console.log("请求成功：", data);
            callback(data);
        },
        error: function (res, error) {
            console.log("请求异常：", res, error);
            errorback(res, error);
        }
    });
}

/**
 *  获取时间戳
 */
function getTimestamp() {
    var date = new Date();
    var year = date.getFullYear().toString();
    var month = (date.getMonth() + 1).toString().padStart(2, '0');
    var day = date.getDate().toString().padStart(2, '0');
    var hour = date.getHours().toString().padStart(2, '0');
    var minute = date.getMinutes().toString().padStart(2, '0');
    var second = date.getSeconds().toString().padStart(2, '0');
    var dateTime = year + "-" + month +"-"+ day +" "+ hour +":"+ minute +":"+ second;
    $("#txtTimestamp").val(dateTime);
    return dateTime;

}

getTimestamp();